package service

import (
	"gitee.com/war2001/NiuMaEasyGo/global"
	"gitee.com/war2001/NiuMaEasyGo/model"
	"gitee.com/war2001/NiuMaEasyGo/nm_core/storage"
	"gorm.io/gorm"
)

// Services 服务集合
type Services struct {
	WechatConfig model.WechatConfigService
	LoginLog     model.LoginLogService
	File         model.FileService
	User         model.UserService // 添加用户服务
}

// NewServices 创建服务集合
func NewServices(db *gorm.DB) *Services {
	// 获取存储管理器
	var storageManager *storage.Manager
	if global.StorageManager != nil {
		storageManager = global.StorageManager
	}

	return &Services{
		WechatConfig: NewWechatConfigService(db),
		LoginLog:     NewLoginLogService(db),
		File:         NewFileService(db, storageManager),
		User:         NewUserService(db), // 添加用户服务
	}
}
